<?php

namespace app\controller;


use app\model\Factory;
use app\model\FactoryIngredient;
use app\model\FactoryMaterial;
use app\model\Material;
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;

//配置控制器
class ConfigController extends Base
{

    /**
     * 工厂列表
     * @throws ModelNotFoundException
     * @throws DbException
     * @throws DataNotFoundException
     */
    public function factory_list(): Response
    {
        $res = (new Factory())->select();
        return $this->success('ok', $res->toArray());
    }


    /**
     * 工厂工具列表
     * @throws ModelNotFoundException
     * @throws DataNotFoundException
     * @throws DbException
     */
    public function factory_material_list(): Response
    {
        $res = (new Material())->select();
        return $this->success('ok', $res->toArray());
    }


    /**
     * 工厂生产材料列表
     * @throws ModelNotFoundException
     * @throws DataNotFoundException
     * @throws DbException
     */
    public function factory_ingredients_list(): Response
    {
        $res = (new FactoryIngredient())->select();
        return $this->success('ok', $res->toArray());
    }



}